import sqlalchemy
from sqlalchemy import create_engine
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Column, Integer, String
from sqlalchemy.orm import sessionmaker

print sqlalchemy.__version__

engine = create_engine('sqlite:///foo.db', echo=True)

Base = declarative_base()


class User(Base):
    __tablename__ = 'users'
    id = Column(Integer, primary_key=True)
    name = Column(String)
    fullname = Column(String)
    password = Column(String)
    def __repr__(self):
        return '<User(name=%s,fullname=%s)>'%(self.name,self.fullname)

# Base.metadata.create_all(engine)

ed_user=User(name='lyc',fullname='llych',password='123456')
print ed_user

Session=sessionmaker(bind=engine)
session=Session()
session.add(ed_user)
session.commit()

print '---',session.query(User).filter_by(name='lyc').first()